package com.example.resource_station_backend.common;


import com.example.resource_station_backend.exception.ErrorCode;
import lombok.Data;


/**
 * @Author xinhao
 * @Description 全局响应封装类
 * @CreateTime 2025-02-2025/2/23 20:48:48
 */
@Data
public class BaseResponse<T> {

    private int code;

    private T data;

    private String message;

    public BaseResponse(int code, T data, String message) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public BaseResponse(int code, T data) {
        this(code, data, "");
    }

    public BaseResponse(ErrorCode errorCode) {
        this(errorCode.getCode(), null, errorCode.getMessage());
    }
}
